package com.cjl.algorithm.help

//外部可直接引用   不需要class

//泛型函数扩展  辅助打印数组
fun <T>Array<T>.text():String{
    var result = "["
    for (t in this){
        when(t){
            is Int-> result = result.plus(t).plus(",")
            else -> {}
        }
    }
    result = result.removeSuffix(",").plus("]")
    return result
}

//普通函数扩展  辅助打印数组
fun Any?.print(){
    println("$this")
}

fun <T>Array<T>.print(){
    this.text().print()
}




